package com.example.nonacademic_education.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.example.nonacademic_education.data.request.FileInfoR;
import com.example.nonacademic_education.data.request.ListData;
import com.example.nonacademic_education.entity.FileApply;
import com.example.nonacademic_education.service.impl.FileServiceImpl;
import com.example.nonacademic_education.util.R;
import org.apache.ibatis.annotations.Delete;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author xinmiao
 * @description
 * @date 2023/4/18 11:17
 */
@RestController
@RequestMapping("file_admin")
public class FileAdminController {
    @Resource
    private FileServiceImpl fileService;
    @PutMapping("audit")
    @SaCheckPermission("file.check")
    public R audit(Long fileId,Integer isPass,Long applyId,String cause){
        return fileService.audit(fileId,isPass,applyId,cause);
    }
    @PostMapping("multiConditionQuery")
    @SaCheckPermission("file.query")
    public R multiConditionQuery(@RequestBody FileInfoR fileInfoR, Integer page, Integer size){
        return fileService.multiConditionQuery(fileInfoR, page, size);
    }
    @DeleteMapping("deleteFiles")
    @SaCheckPermission("file.delete")
    public R deleteFiles(@RequestBody ListData listData,Long applyId){
        return fileService.deleteFiles(listData.getIds(),applyId);
    }
}
